package talentViews;

import com.example.gameproject_1.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;

public class RectsGameMenu extends Activity implements OnClickListener {

	ImageButton startButton,moreGameButton,SoundButton,helpButton;
	TextView scoreTextView,bestScoreTextView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.rects_menu);
		
		ShowMenu();
	}
	void ShowMenu(){
		InitView_Menu();
	}
	void InitView_Menu(){
		setContentView(R.layout.rects_menu);
		//setContentView(R.layout.graphics_menu);
		startButton = (ImageButton)findViewById(R.id.startButton);
		//moreGameButton =(ImageButton) findViewById(R.id.moreGameButton);
		//SoundButton = (ImageButton)findViewById(R.id.soundButton);
		//helpButton = (ImageButton)findViewById(R.id.helpButton);
		scoreTextView = (TextView)findViewById(R.id.score);
		bestScoreTextView = (TextView)findViewById(R.id.bestScore);
		
		startButton.setOnClickListener(this);
		/*moreGameButton.setOnClickListener(this);
		SoundButton.setOnClickListener(this);
		helpButton.setOnClickListener(this);*/
		
		int BestScore = getSharedPreferences("RectsGame", MODE_PRIVATE).getInt("BestScore",0);
		bestScoreTextView.setText(""+BestScore);
	}


	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
 		if(v==startButton){
			Intent intent=new Intent(RectsGameMenu.this,AttackRectGameActivity.class);
			//startActivity(intent);
			startActivityForResult(intent,1);
		}
		else if(v == moreGameButton){
			
		}else if(v == SoundButton){
			
		}else if( v == helpButton){
			
		}
	}
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		if(resultCode ==1)
		{
			int score = data.getIntExtra("Score",0);
		    scoreTextView.setText(""+score);
			int BestScore = getSharedPreferences("RectsGame", MODE_PRIVATE).getInt("BestScore",0);
			bestScoreTextView.setText(""+BestScore);
		}
	}

}
